package com.ctrl.riveradministrator.mvp.presenter;

import android.util.Log;

import com.ctrl.riveradministrator.base.BaseObserver;
import com.ctrl.riveradministrator.base.BasePresenter;
import com.ctrl.riveradministrator.mvp.model.Bulletin;
import com.ctrl.riveradministrator.mvp.view.activity.bulletin.BulletinView;


import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class BulletinPresenter extends BasePresenter<BulletinView> {

    public BulletinPresenter(BulletinView baseView) {
        super(baseView);
    }

    /**
     * 公示牌展示信息
     *
     * @param pageNumb 索引页数
     * @param pageSize 索引条数
     */
    public void getBulletin(String pageNumb, String pageSize) {
        Map<String, String> map = new HashMap<>();
        map.put("pageNumb", pageNumb);
        map.put("pageSize", pageSize);
        attachView(apiService.getBulletin(map), new BaseObserver<Bulletin>(getBaseView()) {
            @Override
            public void onSuccess(Bulletin model) {
                Log.d("onSuccess",":");
            }

            @Override
            public void onSuccess(List<Bulletin> model) {
                getBaseView().showMessage(model);
            }

            @Override
            public void onFailed(String msg) {
                Log.d("onFailed",":"+msg);
            }

        });
    }
}
